
	<div id="dlgAlert" class="easyui-dialog" title="告警列表"  closed="true"  style="width:750px;height:416px;padding:10px">	
	
	<table>
		<tr>
			<td>
			<p> 时间选择：
			<select onChange="showRight(this.value);">
			  <option value="a" selected="selected">全部</option>
			  <option value="b">未读</option>
			  <option value="c">今天</option>
			  <option value="d">本周</option>
			  <option value="e">本月</option>
			</select>
			</p>
			</td>
			<td>
			<p>  &nbsp;&nbsp;   &nbsp;  &nbsp; &nbsp;  &nbsp;  </p>
			</td>
			<td>
			<p>  &nbsp;&nbsp;   &nbsp;  &nbsp;  读取状态：[<a href="javascript:void(0);" onclick = "readSQL()">全设为已读</a>] </p>
			</td>
		</tr>
	</table>
	
	<div style="margin:0px 0;"></div>
	<table id="dgAlert"  style="width:720px;height:310px"
			data-options="rownumbers:true,singleSelect:true,pagination:true">
		<thead>
			<tr>
				<th data-options="field:'notifactionName',width:80">报警类型</th>
				<th data-options="field:'createTime',width:150">报警时间</th>
				<th data-options="field:'content',width:370,align:'right'">报警内容</th>
				<th data-options="field:'readFlag',width:34,align:'right'">状态</th>
			</tr>
		</thead>
		
		
	</table>
	</div>
	
	<script>
	function showRight(v){
	   
	    switch(v){
	        case 'a':
	        	$('#dgAlert').datagrid({loadFilter:pagerFilter}).datagrid({   
					 url:'../../zend_obd/jsonAPI/alarmFaction.php?vin='+alertVin
							 }
				);
	        break;
	        case 'b':
	        	$('#dgAlert').datagrid({loadFilter:pagerFilter}).datagrid({   
					 url:'../../zend_obd/jsonAPI/unReadFcation.php?vin='+alertVin
							 }
				);
	        
	        break;
	        case 'c':
	        	$('#dgAlert').datagrid({loadFilter:pagerFilter}).datagrid({   
					 url:'../../zend_obd/jsonAPI/toDayFlag.php?vin='+alertVin
							 }
				);
	        
	        break;
	        case 'd':
	        	$('#dgAlert').datagrid({loadFilter:pagerFilter}).datagrid({   
					 url:'../../zend_obd/jsonAPI/weekFlag.php?vin='+alertVin
							 }
				);
		    
		    break;
	        case 'e':
	        	$('#dgAlert').datagrid({loadFilter:pagerFilter}).datagrid({   
					 url:'../../zend_obd/jsonAPI/monthFlag.php?vin='+alertVin
							 }
				);
	        	
		    
		    break;
	    }
	}
	</script>
	
	<script type="text/javascript">
		       var alertVin;
		     function initAlert(vin){
		    	
		    	 alertVin=vin;
		    	 $('#dgAlert').datagrid({loadFilter:pagerFilter}).datagrid({   
					 url:'../../zend_obd/jsonAPI/alarmFaction.php?vin='+vin
							 }
				); 
		     }
				
	</script>
	<script>
		function readSQL(){
			
			
			$.post("../../zend_obd/jsonAPI/readFlag.php",
					{
					vin:alertVin
					},
					function(data,status){
						var rows = eval(data);
						
						
						if(rows=="200")
							alert("OK");
						else
							alert("error");
					});
		
			$('#dgAlert').datagrid({loadFilter:pagerFilter}).datagrid({   
				 url:'../../zend_obd/jsonAPI/alarmFaction.php?vin='+alertVin
						 }
			);
			
	
		}
			
			
	
	</script>
	
	<script type="text/javascript">
		$(function(){
			//var pager = $('#dgAlert').datagrid({loadFilter:pagerFilter}).datagrid('getPager');	// get the pager of datagrid
		});
		
		
	//	$('#dg').datagrid({loadFilter:pagerFilter}).datagrid({   
	//						 url:'../service/vehicles4dep.php?searchType=0&deps='+treeTmp
		function pagerFilter(data){
			if (typeof data.length == 'number' && typeof data.splice == 'function'){	// is array
				data = {
					total: data.length,
					rows: data
				}
			}
			var dg = $(this);
			var opts = dg.datagrid('options');
			var pager = dg.datagrid('getPager');
			pager.pagination({
				onSelectPage:function(pageNum, pageSize){
					opts.pageNumber = pageNum;
					opts.pageSize = pageSize;
					pager.pagination('refresh',{
						pageNumber:pageNum,
						pageSize:pageSize
					});
					dg.datagrid('loadData',data);
				}
			});
			if (!data.originalRows){
				data.originalRows = (data.rows);
			}
			var start = (opts.pageNumber-1)*parseInt(opts.pageSize);
			var end = start + parseInt(opts.pageSize);
			data.rows = (data.originalRows.slice(start, end));
			return data;
		}
	</script>
	
	
	

	
    
   
   
    

